'''
@Author: your name
@Date: 2020-05-17 21:40:29
@LastEditTime: 2020-05-17 22:02:59
@LastEditors: Please set LastEditors
@Description: In User Settings Edit
@FilePath: \Gitee\crawler_test\crawl_baidu.py
'''
import requests
import os

def spider_baidu():
    url = 'https://www.baidu.com/'
    kv = {'wd': 'python'}
    try:
        r = requests.get(url, params=kv)
        r.raise_for_status()
        print(r.text[:1000])
    except:
        print('爬取失败')

spider_baidu()